<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>登录 - 多模态网络诈骗识别和预警系统</title>
    <link rel="stylesheet" href="css/style.css">
    <style>
        .login-container {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
        }

        .login-box {
            background: white;
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 5px 15px rgba(0,0,0,0.2);
            width: 100%;
            max-width: 450px;
        }

        .login-header {
            text-align: center;
            margin-bottom: 30px;
        }

        .login-header h1 {
            color: #2c3e50;
            font-size: 24px;
            margin-bottom: 10px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .login-header p {
            color: #666;
            font-size: 14px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group label {
            display: block;
            margin-bottom: 8px;
            color: #2c3e50;
            font-weight: bold;
        }

        .form-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 16px;
            transition: border-color 0.3s;
        }

        .form-group input:focus {
            border-color: #3498db;
            outline: none;
        }

        .login-btn {
            width: 100%;
            padding: 12px;
            background: #3498db;
            color: white;
            border: none;
            border-radius: 5px;
            font-size: 16px;
            cursor: pointer;
            transition: background 0.3s;
        }

        .login-btn:hover {
            background: #2980b9;
        }

        .error-message {
            color: #e74c3c;
            font-size: 14px;
            margin-top: 5px;
            display: none;
        }
    </style>
</head>
<body>
    <div class="login-container">
        <div class="login-box">
            <div class="login-header">
                <h1>多模态网络诈骗识别和预警系统</h1>
                <p>请登录以继续使用系统</p>
            </div>
            <form id="loginForm" onsubmit="return handleLogin(event)">
                <div class="form-group">
                    <label for="username">用户名</label>
                    <input type="text" id="username" name="username" required>
                    <div class="error-message" id="usernameError">用户名不能为空</div>
                </div>
                <div class="form-group">
                    <label for="password">密码</label>
                    <input type="password" id="password" name="password" required>
                    <div class="error-message" id="passwordError">密码不能为空</div>
                </div>
                <div class="error-message" id="loginError">用户名或密码错误</div>
                <button type="submit" class="login-btn">登录</button>
            </form>
        </div>
    </div>

    <script>
        function handleLogin(event) {
            event.preventDefault();
            
            // 获取输入值
            const username = document.getElementById('username').value;
            const password = document.getElementById('password').value;
            
            // 重置错误提示
            document.getElementById('usernameError').style.display = 'none';
            document.getElementById('passwordError').style.display = 'none';
            document.getElementById('loginError').style.display = 'none';
            
            // 验证用户名和密码
            if (!username) {
                document.getElementById('usernameError').style.display = 'block';
                return false;
            }
            
            if (!password) {
                document.getElementById('passwordError').style.display = 'block';
                return false;
            }
            
            // 检查用户名和密码是否正确
            if (username === 'admin' && password === 'admin') {
                // 登录成功，跳转到首页
                window.location.href = 'index.html';
            } else {
                // 显示登录错误信息
                document.getElementById('loginError').style.display = 'block';
            }
            
            return false;
        }

        // 在按下回车键时也触发登录
        document.addEventListener('keypress', function(e) {
            if (e.key === 'Enter') {
                document.getElementById('loginForm').dispatchEvent(new Event('submit'));
            }
        });
    </script>
</body>
</html> 